* hiroshima_data_master.do

* Create the main population and employment series by city block
do "../../code/Stata/hiroshima_1933_75_popemp.do"
* The following is just to produce Figure XXX 
do "../../code/Stata/1933_60_population_aggregationepicenter.do"

use "../../data/processed data/1933_75_popemp.dta", clear 

* Merge the location characteristics data with our population/employment series. hiroshima_fundamental is from the raw folder
merge 1:1 block using "../../data/raw data/hiroshima_fundamental.dta"
keep if _merge == 3 
drop _merge 

** Dataset used for reduced-form analyis (HIROSHIMA_REDUCEDFORM.do)
save "../../data/processed data/hiroshima_main_1933_75.dta", replace

* For the matlab estimation data
rename cbd_dist cbddist
rename Total6 FS_60_65
rename Total11 FS_55_60
rename Total16 FS_50_55
rename Total21 FS_45_50
rename Total21ove FS_pre45

keep geocode size pop33 pop34 pop36 pop45bomb pop49 pop50 pop51 pop52 pop53 pop55 pop60 pop65 pop70 pop75 emp38 emp45bomb emp53 emp57 emp63 emp66 emp75 lnQ_50 lnQ_55 lnQ_60 lnQ_65 lnQ_70 lnQ_75 FS_pre45 FS_45_50 FS_50_55 FS_55_60 FS_60_65 lon lat cbddist
rename size area

** Dataset used for structural analysis in MATLAB 
export delimited using "../../data/processed data/quant/Hiroshima_DATA.csv", replace

* focus on 3km sample (note that研屋町 is within 3km)
keep if cbddist < 3
export delimited using "../../data/processed data/quant/Hiroshima_DATA_3km.csv", replace



